package com.tencent.controller;/**
 * @Author King
 * @Date 2022/9/2 12:19
 * @Version 1.0.0
 */

import com.tencent.entity.Member;
import com.tencent.entity.Order;
import com.tencent.entity.Result;
import com.tencent.entity.SetMeal;
import com.tencent.service.MemberYService;
import com.tencent.service.OrderService;
import com.tencent.service.SetmealService;
import com.tencent.utils.DateUtils;
import jdk.nashorn.internal.ir.annotations.Reference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: health2.2
 *
 * @description:
 *
 * @author: king
 *
 * @create: 2022-09-02 12:19
 **/
@RestController
@RequestMapping("/order1")
public class OrderController {
    @Autowired
    private OrderService orderService;
    @Autowired
    private MemberYService memberYService;
    @Autowired
    private SetmealService setmealService;

    @RequestMapping("/submit")
    public Result submit(@RequestBody Map map){
//        System.out.println(map);
        Integer id = orderService.order(map);
        return Result.success(id);
    }
    @RequestMapping("/findById")
    public Result findById(Integer id){
        try {
            Map map =  orderService.findById(id);
            return Result.success(map);
        } catch (Exception e) {
            e.printStackTrace();
            return Result.noLogin("失败");
        }


    }
}
